import type { categoryInter, categoryData } from '@/types/article'
import request, { type Data } from '@/utils/request'
// import { useTokenStore } from '@/stores/token'

// 文章分类列表查询
export const articleCategoryService = () => {
  // const tokenStore = useTokenStore()
  // const token = tokenStore.token
  return request.get<Data<categoryData[]>>('/category')
  // return request.get('/category', {
  //   headers: {'Authorization': token}
  // })
}
// 添加文章分类
export const addArticleCategoryService = (categoryData: categoryInter) => {
  return request.post<Data<object>>('/category', categoryData)
}
// 更新文章分类
export const updateArticleCategoryService = (categoryData: categoryInter) => {
  return request.put<Data<object>>('/category', categoryData)
}
// 删除文章分类
export const deleteArticleCategoryService = (id: number) => {
  return request.delete<Data<object>>('/category', { params: { id } })
}
